import os
from keras import Sequential
from keras.layers import Dense

from chapter04.mnist_dataset import MNISTLoader
from keras.optimizers import Adam
from keras.losses import mean_squared_error

if __name__ == '__main__':
    os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

    model = Sequential(layers=[
        # Dense(units=28 * 28, name="input_layer"),
        Dense(units=64, activation="relu", name="hidden_layer"),
        Dense(units=10, activation="softmax", name="output_layer"),
    ])

    model.build(input_shape=(60000, 28 * 28))
    model.summary()

    model.pop()
    model.summary()
    # model = Sequential()
    # model.add(Dense(units=64, activation="relu", name="hidden_layer"))
    # model.add(Dense(units=10, activation="softmax", name="output_layer"))
    # model.build(input_shape=(60000, 28 * 28))
    # model.summary()

    # model.compile(optimizer=Adam(), loss=mean_squared_error, metrics=['accuracy'])
    #
    # dataset = MNISTLoader()
    #
    # train_data = dataset.get_train_data()
    # train_label = dataset.get_train_label()
    #
    # test_data = dataset.get_test_data()
    # test_label = dataset.get_test_label()
    #
    # x = train_data.reshape((60000, 28 * 28)).astype('float32') / 255
    # y = train_label.astype('float32')
    #
    # model.fit(x=x, y=y, epochs=10, verbose='auto', batch_size=64)
    #
    # x_test = test_data.reshape((10000, 28 * 28)).astype('float32') / 255
    # y_test = test_label.astype('float32')
    #
    # loss, accuracy = model.evaluate(x=x_test, y=y_test, batch_size=64, verbose=1)
    #
    # print(f"Test loss: {loss}")
    # print(f"Test accuracy: {accuracy}")
